package im.starchat.chat.dialog;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import im.starchat.chat.R;
import im.starchat.chat.activity.profile.MyDiamondActivity;

public class RechargeFragment extends DialogFragment {

    Dialog dialog;

    private TextView mCancelBtn;
    private TextView mBuyBtn;

    public static RechargeFragment newInstance() {
        RechargeFragment showDeleteFavDialogFragment = new RechargeFragment();
        Bundle bundle = new Bundle();
        showDeleteFavDialogFragment.setArguments(bundle);
        return showDeleteFavDialogFragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        LayoutInflater inflater = getActivity().getLayoutInflater();
        View view = inflater.inflate(R.layout.dialog_recharge, null);
        builder.setView(view);
        dialog = builder.create();
        mCancelBtn = (TextView)view.findViewById(R.id.cancel);
        mBuyBtn = (TextView) view.findViewById(R.id.buy);
        mCancelBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
            }
        });

        mBuyBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent toChargeIntent = new Intent();
                toChargeIntent.setClass(getActivity(), MyDiamondActivity.class);
                getActivity().startActivity(toChargeIntent);
            }
        });

        return dialog;
    }

//    @Override
//    public Dialog onCreateDialog(Bundle savedInstanceState) {
//        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
//        builder.setMessage("是否退出？")
//                .setPositiveButton("退出登陆", new DialogInterface.OnClickListener() {
//                    public void onClick(DialogInterface dialog, int id) {
//                        if (alertDialogClickListener != null) {
//                            alertDialogClickListener.onPositiveButtonClick();
//                        }
//                    }
//                })
//                .setNegativeButton("暂不退出", new DialogInterface.OnClickListener() {
//                    public void onClick(DialogInterface dialog, int id) {
//                        if (alertDialogClickListener != null) {
//                            alertDialogClickListener.onNegativeButtonClick();
//                        }
//                    }
//                });
//        return builder.create();
//    }

}
